<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./template/user.xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://xmlns.jcp.org/jsf/core">

    <ui:define name="header"/>

    <ui:define name="context">
        <div class="section_w500">
            #{a_languageManagedBean.set_list()}
            #{a_countryManagedBean.set_list()} 

            <h:panelGrid id="display" columns="2" cellpadding="4">

                <h:outputText value="I am a :" />  
                <p:selectOneMenu value="#{u_searchManagedBean.whoFind}">
                    <f:selectItem itemLabel="Man looking for women" itemValue="1"/>
                    <f:selectItem itemLabel="Woman looking for men" itemValue="2"/>
                    <f:selectItem itemLabel="Man looking for men" itemValue="3"/>
                    <f:selectItem itemLabel="Woman looking for women" itemValue="4"/>
                </p:selectOneMenu>

                <h:outputText value="between ages :" />
                <p:selectOneMenu value="#{u_searchManagedBean.beginAge}">
                    <f:selectItems var="age" value="#{u_searchManagedBean.lstAge}" 
                                   itemLabel="${age}" itemValue="${age}"/>
                </p:selectOneMenu>

                <h:outputText value="" />
                <p:selectOneMenu value="#{u_searchManagedBean.endAge}">
                    <f:selectItems var="age" value="#{u_searchManagedBean.lstAge}" 
                                   itemLabel="${age}" itemValue="${age}"/>
                </p:selectOneMenu>

                <h:outputLabel value="Country :"/>
                <p:selectOneMenu id="MenuCountry" value="#{u_memberManagedBean.IDCountry}" 
                                 styleClass="selectMenu" label="Menu Country">
                    <f:selectItem itemLabel="Select Country" itemValue=""/>
                    <f:selectItems var="country" value="#{a_countryManagedBean.list}" 
                                   itemValue="${country.id}" itemLabel="${country.country}"/>
                    <p:ajax update="MenuState" listener="#{u_memberManagedBean.handleStateChange()}"/>
                </p:selectOneMenu>

                <h:outputLabel value="State :"/>
                <p:selectOneMenu id="MenuState" value="#{u_searchManagedBean.selectState}" 
                                 styleClass="selectMenu" label="Menu State">
                    <f:selectItem itemLabel="Select Status" itemValue=""/>
                    <f:selectItems var="state" value="#{u_memberManagedBean.lstState}"
                                   itemLabel="${state.state}" itemValue="${state.id}"/>
                </p:selectOneMenu>

                <h:outputText value="" />
                <p:commandButton value="Search" action="#{u_searchManagedBean.search()}"/>
                
            </h:panelGrid>
        </div>
    </ui:define>

</ui:composition>
